<?php
$fname = $_POST['firstname'];
$lname = $_POST['lastname'];
$minit = $_POST['middleinitial'];
$username = $_POST['username'];
$pword = $_POST['password'];
$phone = $_POST['pnumber'];
$email = $_POST['email'];

$db = 'Eventdb1';

$dbConn=odbc_connect($db,'','');

$sql="INSERT INTO Participant (Fname, Minit, Lname, username, password, Phone, Email)
VALUES($fname, $minit, $lname, $username, $pword, $phone, $email)";

$sql2= "SELECT username FROM Participant";

$dbexec = odbc_exec($dbConn,$sql2);

$numFields = odbc_num_fields($dbexec);

for($i = 1; $i <= $numFields; $i++)
{
	if($username == obdc_result($dbexec, $i))
	{
		echo 'Username Exist';
	}
	else
	{
		$dbexec= odbc_exec($dbConn,$sql);
	}
}


echo 'First Name: ', $fname;
echo "<br>";
echo 'M.I.: ',$minit;
echo "<br>";
echo 'Last Name: ',$lname;
echo "<br>";
echo 'Email: ', $email;
echo "<br>";
echo "<br>";



?>